package amdocs.utils.wishlistapp;

import java.net.UnknownHostException;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBObject;
import com.mongodb.Mongo;
import com.mongodb.WriteConcern;



/**
 * @author AMITJHA
 * Sammple java program to test mongo db connectivity and basic operation
 */
public class TestMongo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		String notes[] = {"Ilya do 8m customer table", 
							"Amit- C to Oracleconnectivity",
							"Chandra- Recon History Table",
							"Implement Inheritence for summary data",
							"Offshore- Summary for Recon Tables",
							"Amit/Valentin- static RGgraph",
							"Amit/Valentin- dynamic RGgraph",
							"Amit- wishlist ui deploy to server"
						 };
		
		Mongo conn = null;
		
		try {
			conn = new Mongo("ranr02v");
			
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		WriteConcern wc = new WriteConcern(1,2000);
		conn.setWriteConcern(wc);
		
		DB db = conn.getDB("wishlistdb");
		DBCollection coll = db.getCollection("wishlists");
		
		for(int i = 0 ; i < notes.length;i++){
			DBObject dbo = new BasicDBObject("wishcolor","yellow");
			dbo.put("wishtext", notes[i]);
			dbo.put("wishapp", "tdac");
			coll.insert(dbo);
			//System.out.println("ready to save " + notes[i]);
		}
		
		
	}

}
